
using System;
using System.Collections.Generic;

namespace Systemathics.FrameWork
{
    /// <summary>
    /// This class contains specific order extenssion given the broker API
    /// </summary>
    [Serializable]
    public class OrderExtension
    {
        /// <summary>
        /// The order ID of the parent order, used for bracket and auto trailing stop orders.
        /// </summary>
        public Guid ParentOrderId { get; set; }

        /// <summary>
        /// Mark an order as "all or none" to specify that the order not execute unless the entire order quantity is available and it can be filled in its entirety. 
        /// This attribute can be applied to all order types.
        /// </summary>
        public bool AllOrNone { get; set; }

        /// <summary>
        /// is the Order valid after classic market hour openning
        /// </summary>
        public bool OutsideRth { get; set; }
        
        #region Relattive /Pegged SmartOrder

        /// <summary>
        /// The percent offset amount for relative orders/ Pegged-to-Primary
        /// </summary>
        public double OffsetAmount { get; set; }

        #endregion Relattive /Pegged SmartOrder

        #region Sweep To Fill SmartOrder

        /// <summary>
        /// If set to true, specifies that the order is a Sweep-to-Fill order.
        /// </summary>
        public bool SweepToFill { get; set; }

        #endregion Swwep To Fill SmartOrder

        #region Time In Force elements

        /// <summary>
        /// The trade's "Good After Time"
        /// </summary>
        /// <remarks>format "YYYYMMDD hh:mm:ss (optional time zone)" 
        /// Use an empty String if not applicable.</remarks>
        public DateTime? GoodAfterTime { get; set; }
       
        /// <summary>
        /// You must enter a Time in Force value of Good Till Date.
        /// </summary>
        /// <remarks>The trade's "Good Till Date," format is:
        /// YYYYMMDD hh:mm:ss (optional time zone)
        /// Use an empty String if not applicable.</remarks>
        public DateTime? GoodTillDate { get; set; }

        /// <summary>
        /// Time in Force value for the order
        /// </summary>
        public TimeInForce Tif { get; set; }

        #endregion Time In Force elements

        //#region IceBerg elements

        ///// <summary>
        ///// If set to true, specifies that the order is an ISE Block order.
        ///// </summary>
        //public bool BlockOrder { get; set; }

        ///// <summary>
        ///// The publicly disclosed order size, used when placing Iceberg orders.
        ///// </summary>
        //public int DisplayedSize { get; set; }

        //#endregion IceBerg elements


        //#region OCA elements

        ///// <summary>
        ///// Identifies an OCA (one cancels all) group.
        ///// </summary>
        //public String OcaGroup{ get; set;}

        ///// <summary>
        ///// Tells how to handle remaining orders in an OCA group when one order or part of an order executes.
        ///// </summary>
        ///// <remarks>
        ///// Valid values include:
        ///// <list type="bullet">
        ///// <item>1 = Cancel all remaining orders with block.</item>
        ///// <item>2 = Remaining orders are proportionately reduced in size with block.</item>
        ///// <item>3 = Remaining orders are proportionately reduced in size with no block.</item>
        ///// </list>
        ///// If you use a value "with block"gives your order has overfill protection. This means  that only one order in the group will be routed at a time to remove the possibility of an overfill.
        ///// </remarks>
        ///// <seealso cref="Systemathics.Framework.Forge.OrderExt.OcaType"/>
        //public OCAType OcaType { get; set; }

        //[Serializable]
        //public enum OCAType
        //{
        //    /// <summary>
        //    /// Undefined Oca Type
        //    /// </summary>
        //    Undefined = 0,
        //    /// <summary>
        //    /// 1 = Cancel all remaining orders with block
        //    /// </summary>
        //    CancelAll = 1,
        //    /// <summary>
        //    /// 2 = Remaining orders are proportionately reduced in size with block
        //    /// </summary>
        //    ReduceWithBlock = 2,
        //    /// <summary>
        //    /// 3 = Remaining orders are proportionately reduced in size with no block
        //    /// </summary>
        //    ReduceWithNoBlock = 3
        //}

        //#endregion OCA elements

        //#region Scale SmartOrder

        ///// <summary>
        ///// split order into X buckets
        ///// </summary>
        //public int ScaleInitLevelSize { get; set; }

        ///// <summary>
        ///// split order so each bucket is of the size X
        ///// </summary>
        //public int ScaleSubsLevelSize { get; set; }

        ///// <summary>
        ///// price increment per bucket
        ///// </summary>
        //public decimal ScalePriceIncrement { get; set; }

        //#endregion Scale SmartOrder

        //#region Discretionary Smart Order

        ///// <summary>
        ///// The amount off the limit price allowed for discretionary orders.
        ///// </summary>
        //public decimal DiscretionaryAmt { get; set; }
        
        //#endregion Discretionary Smart Order

        //#region Algorithm SmartOrder

        //public String AlgoStrategy { get; set; }
        //public Dictionary<String, Object> AlgoParams { get; set; }

        //#endregion Algorithm SmartOrder

        public OrderExtension()
        {
            ParentOrderId = Guid.Empty;
            AllOrNone = false;
            //BlockOrder = false;
            //DisplayedSize = 0;

            OutsideRth = false;

            Tif = TimeInForce.Day;
            GoodAfterTime = null ;
            GoodTillDate = null;

            //OcaGroup = String.Empty;

            OffsetAmount = 0;

            SweepToFill = false;
          
            //ScaleInitLevelSize = Int32.MaxValue;
            //ScaleSubsLevelSize = Int32.MaxValue;
            //ScalePriceIncrement = Decimal.MaxValue;

            //DiscretionaryAmt = Decimal.MaxValue;

            //AlgoStrategy = String.Empty;
            //AlgoParams = new Dictionary<string, object>();
        }
    }
}